module nade.render;

import nade.location;
import nade.space;


final class RenderObject : Locatable {
	alias void delegate() RenderDg;

	this(RenderDg renderDg)
	{
		_renderDg = renderDg;
	}

	void render()
	{
		assert(location !is null);
		if(_renderDg !is null) location.render(_renderDg);
	}

	private {
		RenderDg		_renderDg;
	}
}


class RenderSpace : Space!(RenderObject) {
	void render()
	{
		foreach(object; _objects) object.render();
	}

	RenderObject spawn(RenderObject.RenderDg renderDg = null)
	{
		return super.attach(new RenderObject(renderDg));
	}
}
